Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@gramio/keyboards
Advanced tools
Framework-agnostic Telegram bot keyboard builder with many cool features!
Framework-agnostic Telegram bot keyboard (and inline query result) builder with many cool features!
npm i @gramio/keyboards
import { Keyboard } from "@gramio/keyboards";
const keyboard = new Keyboard()
.text("first row")
.row()
.text("second row")
.build(); // NOTE: In GramIO, you don't have to use the ".build" method
import { Bot, Keyboard } from "gramio"; // import from GramIO package!!
const bot = new Bot(process.env.TOKEN as string);
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (ctx) => {
return ctx.send("test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla"),
});
});
bot.start();
import { Keyboard } from "@gramio/keyboards";
import { Bot } from "grammy";
const bot = new Bot(process.env.TOKEN as string);
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (ctx) => {
return ctx.reply("test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla")
.build(),
});
});
bot.start();
[!WARNING] The
Telegraf
does not support the latest version of Bot API
import { Keyboard } from "@gramio/keyboards";
import { Telegraf } from "telegraf";
const bot = new Telegraf(process.env.TOKEN as string);
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (ctx) => {
return ctx.reply("test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla")
.build(),
});
});
bot.launch();
[!WARNING] The
node-telegram-bot-api
does not support the latest version of Bot API and the types are badly written, so the types may not match
import { Keyboard } from "@gramio/keyboards";
import TelegramBot from "node-telegram-bot-api";
const bot = new TelegramBot(process.env.TOKEN as string, { polling: true });
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (msg) => {
return bot.sendMessage(msg.chat.id, "test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla")
.build(),
});
});
[!WARNING] The
puregram
does not support the latest version of Bot API
import { Telegram } from "puregram";
import { Keyboard } from "@gramio/keyboards";
const bot = new Telegram({
token: process.env.TOKEN as string,
});
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (ctx) => {
return ctx.send("test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla")
.build(),
});
});
bot.updates.startPolling();
{
"keyboard": [
[
{
"text": "simple keyboard"
}
],
[
{
"text": "Apple"
}
],
[
{
"text": "Realme"
}
],
[
{
"text": "Xiaomi"
}
]
],
"one_time_keyboard": false,
"is_persistent": false,
"selective": false,
"resize_keyboard": true
}
FAQs
Framework-agnostic Telegram bot keyboard builder with many cool features!
We found that @gramio/keyboards demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.